package com.oldbook.manage.controller;

import com.oldbook.common.annotation.Log;
import com.oldbook.common.core.controller.BaseController;
import com.oldbook.common.core.domain.AjaxResult;
import com.oldbook.common.core.page.TableDataInfo;
import com.oldbook.common.enums.BusinessType;
import com.oldbook.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.oldbook.manage.domain.VStudentOrderDetail;
import com.oldbook.manage.service.IVStudentOrderDetailService;


/**
 * 查看单个学生选订教材视图Controller
 *
 * @author Exiaoke
 * @date 2025-02-19
 */
@RestController
@RequestMapping("/manage/studentOrderDetail")
@Api(tags = "查看单个学生选订教材视图管理")
public class VStudentOrderDetailController extends BaseController {

    @Autowired
    private IVStudentOrderDetailService vStudentOrderDetailService;

/**
 * 查询查看单个学生选订教材视图列表
 */
@PreAuthorize("@ss.hasPermi('manage:studentOrderDetail:list')")
@GetMapping("/list")
@ApiOperation("查询查看单个学生选订教材视图列表")
    public TableDataInfo list(@ApiParam("查看单个学生选订教材视图对象") VStudentOrderDetail vStudentOrderDetail) {
        startPage();
        List<VStudentOrderDetail> list = vStudentOrderDetailService.selectVStudentOrderDetailList(vStudentOrderDetail);
        return getDataTable(list);
    }

    /**
     * 导出查看单个学生选订教材视图列表
     */
    @PreAuthorize("@ss.hasPermi('manage:studentOrderDetail:export')")
    @Log(title = "查看单个学生选订教材视图", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出查看单个学生选订教材视图列表")
    public void export(HttpServletResponse response, @ApiParam("查看单个学生选订教材视图对象") VStudentOrderDetail vStudentOrderDetail) {
        List<VStudentOrderDetail> list = vStudentOrderDetailService.selectVStudentOrderDetailList(vStudentOrderDetail);
        ExcelUtil<VStudentOrderDetail> util = new ExcelUtil<VStudentOrderDetail>(VStudentOrderDetail.class);
        util.exportExcel(response, list, "查看单个学生选订教材视图数据");
    }

    /**
     * 获取查看单个学生选订教材视图详细信息
     */
    @PreAuthorize("@ss.hasPermi('manage:studentOrderDetail:query')")
    @GetMapping(value = "/{学号}")
    @ApiOperation("获取查看单个学生选订教材视图详细信息")
    public AjaxResult getInfo(@PathVariable("学号") @ApiParam("学号的值") String 学号) {
        return success(vStudentOrderDetailService.selectVStudentOrderDetailBy学号(学号));
    }

    /**
     * 新增查看单个学生选订教材视图
     */
    @PreAuthorize("@ss.hasPermi('manage:studentOrderDetail:add')")
    @Log(title = "查看单个学生选订教材视图", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增查看单个学生选订教材视图")
    public AjaxResult add(@RequestBody @ApiParam("要添加的查看单个学生选订教材视图对象") VStudentOrderDetail vStudentOrderDetail) {
        return toAjax(vStudentOrderDetailService.insertVStudentOrderDetail(vStudentOrderDetail));
    }

    /**
     * 修改查看单个学生选订教材视图
     */
    @PreAuthorize("@ss.hasPermi('manage:studentOrderDetail:edit')")
    @Log(title = "查看单个学生选订教材视图", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改查看单个学生选订教材视图")
    public AjaxResult edit(@RequestBody @ApiParam("要修改的查看单个学生选订教材视图对象") VStudentOrderDetail vStudentOrderDetail) {
        return toAjax(vStudentOrderDetailService.updateVStudentOrderDetail(vStudentOrderDetail));
    }

    /**
     * 删除查看单个学生选订教材视图
     */
    @PreAuthorize("@ss.hasPermi('manage:studentOrderDetail:remove')")
    @Log(title = "查看单个学生选订教材视图", businessType = BusinessType.DELETE)
    @DeleteMapping("/{学号s}")
    @ApiOperation("删除查看单个学生选订教材视图")
    public AjaxResult remove(@PathVariable @ApiParam("要删除的学号数组") String[] 学号s) {
        return toAjax(vStudentOrderDetailService.deleteVStudentOrderDetailBy学号s(学号s));
    }
}